package com.zhaoyh.framework.code.servlet;

import com.zhaoyh.framework.code.util.LogUtil;
import com.zhaoyh.framework.code.util.WebContextUtil;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;


/**
 * @author 祥霸
 * @date 2019/2/22
 */
public class LoadOnStartup extends HttpServlet {
    private static final long serialVersionUID = 1L;

    public void init() throws ServletException {
        LogUtil.log.info("System init start......");

        long startTime = System.currentTimeMillis();

        WebContextUtil.init(this.getServletContext());

        // 结束初始化工作
        super.init();
        long endTime = System.currentTimeMillis();
        LogUtil.log.info("System init over, use " + ((float) (endTime - startTime) / 1000) + " seconds.");
    }
}
